package com.syn.michat.mapper;

import com.syn.michat.pojo.ScreenshotsReport;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ScreenshotsReportMapper {

    @Insert({"insert into t_screenshots_report(user_id, target_id, file_name, time) values(#{userId}, #{targetId}, #{fileName}, #{time})"})
    public void save(ScreenshotsReport report);

    @Select("select * from t_screenshots_report where target_id = #{userId} and user_id = #{targetId} or target_id = #{targetId} and user_id = #{userId}")
    @ResultMap("result")
    public List<ScreenshotsReport> queryAllReport(String targetId, String userId);
}
